<%@page import="com.hrm.entity.Menu"%>
<%@page import="com.hrm.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<title>用户添加页面</title>
<link href="<%=request.getContextPath()%>/css/Default.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/redmond/jquery-ui-1.8.14.custom.css"
	rel="stylesheet" type="text/css"></link>
<link href="<%=request.getContextPath()%>/css/Dialog.css"
	rel="stylesheet" type="text/css"></link>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="<%=request.getContextPath()%>/scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/scripts/HRM.js" type="text/javascript"></script>
<script
	src="<%=request.getContextPath()%>/scripts/jquery-ui-1.8.14.min.js"
	type="text/javascript"></script>
<script
	src="<%=request.getContextPath()%>/scripts/jquery.validate.min.js"
	type="text/javascript"></script>
<script
	src="<%=request.getContextPath()%>/scripts/jquery.validate.message_cn.js"
	type="text/javascript"></script>
<script
	src="<%=request.getContextPath()%>/scripts/Dialog.js"
	type="text/javascript"></script>
</head>
<body class="dialogBody">
<script type="text/javascript">
function beforeFormSubmitFunc(){
	var checkNum=0;
	var roleids='';//角色列表
	$("#roleTree ul").find("li").each(function(index){
		if($(this).attr('id')!=''&&($(this).attr('class').indexOf('jstree-checked')>-1)){
			checkNum++;
			roleids=roleids+$(this).attr('id')+',';
		}
	});
	if(checkNum<=0){
		createAlertDialog('提示信息','请至少选择一个角色!');
		return false;
	}
	var url=$("#menuEditForm").attr('action')+'&roleids='+roleids.substring(0,roleids.length-1);
	$("#menuEditForm").attr('action',url);
	if(!$("#menuEditForm").valid()){
		createAlertDialog('提示信息','还有未正确填写的项，请参照提示修改!');
		return false;
	}else{
		return true;
	}
}
$().ready(function(){
	$("#menuEditForm").validate({
		rules:{
			userName:{
				required:true
			}
		},
		errorPlacement:function(error,element){
			createTooltip(error,element);
		},
		success:function(error,element){
			sucRemoveTooltip(error);
		},
		event:'blur'|'keyup'|'focus'|'keydown'
	});
	$('#menuEditForm').find("input").focus(function(){
		$(this).valid();
	});
	$('#menuEditForm').find("input").blur(function(){
		$('#'+$(this).attr('id')+'Error').remove();
	});
	$('#menuEditForm').find('#menuName').focus();
});
</script>
<form id="menuEditForm" action='<%=request.getContextPath()%>/menu.do?method=updateMenuById' method="post">
<center>
<table width="100%" align="center" cellpadding="2" cellspacing="0">
    <tr>
      <td height="10"></td>
      <td><input name="id" type="hidden" value="<%=((Menu)request.getAttribute("menu")).getId() %>"
									id="id" /></td>
    </tr>
    <tr>
      <td>
   <fieldset>
    <legend><label>基本信息</label></legend>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="39%" height="30" align="right" >菜单名称：</td>
          <td width="61%"><input name="menuName"  type="text" id="menuName" value='<%=((Menu)request.getAttribute("menu")).getMenuName() %>' /><span class='requiredSpan'>*</span></td>
        </tr>
        <tr>
          <td height="30" align="right" >是否可见：</td>
          <td ><input type='radio' name='viewMode' id='Status_0' value='N' checked><label for='Status_0'>是</label><input type='radio' name='viewMode' id='Status_1' value='Y'><label for='Status_1'>否</label></td>
        </tr>
        <tr>
          <td height="30" align="right" >备注：</td>
          <td><input name="remark" type="text"  id="remark" value="<%=((Menu)request.getAttribute("menu")).getRemark() %>"/></td>
        </tr>
      </table></fieldset></td>
    </tr>
	</table>
	</center>
</form>

</body>
</html>